package org.sdfc.model.dfc

import com.documentum.fc.common.IDfId
import com.documentum.fc.common.IDfTime

import org.sdfc.model.MutableTypedObject
import org.sdfc.model.attr._

/** MutableTypedObject implementation backed by the DFC.
 */
trait DfcMutableTypedObject extends DfcTypedObject with MutableTypedObject {
  
  /** Sets all values for a RepeatingBooleanAttribute. */
  def setBooleanValues(attr : RepeatingBooleanAttribute, values : TraversableOnce[Boolean]) : Unit = {
    removeAll(attr)
    appendBooleanValues(attr, values)
  }
  
  /** Sets all values for a RepeatingIntAttribute. */
  def setIntValues(attr : RepeatingIntAttribute, values : TraversableOnce[Int]) : Unit = {
    removeAll(attr)
    appendIntValues(attr, values)
  }
  
  /** Sets all values for a RepeatingStringAttribute. */
  def setStringValues(attr : RepeatingStringAttribute, values : TraversableOnce[String]) : Unit = {
    removeAll(attr)
    appendStringValues(attr, values)
  }
  
  /** Sets all values for a RepeatingIdAttribute. */
  def setIdValues(attr : RepeatingIdAttribute, values : TraversableOnce[IDfId]) : Unit = {
    removeAll(attr)
    appendIdValues(attr, values)
  }
  
  /** Sets all values for a RepeatingTimeAttribute. */
  def setTimeValues(attr : RepeatingTimeAttribute, values : TraversableOnce[IDfTime]) : Unit = {
    removeAll(attr)
    appendTimeValues(attr, values)
  }
  
  /** Sets all values for a RepeatingDoubleAttribute. */
  def setDoubleValues(attr : RepeatingDoubleAttribute, values : TraversableOnce[Double]) : Unit = {
    removeAll(attr)
    appendDoubleValues(attr, values)
  }
  
  
   /** Appends some values to existing ones of a RepeatingBooleanAttribute. */
  def appendBooleanValues(attr : RepeatingBooleanAttribute, values : TraversableOnce[Boolean]) : Unit =
	for ( value <- values )
	  appendBoolean(attr, value)
  
  /** Appends some values to existing ones of a RepeatingIntAttribute. */
  def appendIntValues(attr : RepeatingIntAttribute, values : TraversableOnce[Int]) : Unit =
	for ( value <- values )
	  appendInt(attr, value)
  
  /** Appends some values to existing ones of a RepeatingStringAttribute. */
  def appendStringValues(attr : RepeatingStringAttribute, values : TraversableOnce[String]) : Unit =
	for ( value <- values )
	  appendString(attr, value)
  
  /** Appends some values to existing ones of a RepeatingIdAttribute. */
  def appendIdValues(attr : RepeatingIdAttribute, values : TraversableOnce[IDfId]) : Unit =
	for ( value <- values )
	  appendId(attr, value)
  
  /** Appends some values to existing ones of a RepeatingTimeAttribute. */
  def appendTimeValues(attr : RepeatingTimeAttribute, values : TraversableOnce[IDfTime]) : Unit =
	for ( value <- values )
	  appendTime(attr, value)
  
  /** Appends some values to existing ones of a RepeatingDoubleAttribute. */
  def appendDoubleValues(attr : RepeatingDoubleAttribute, values : TraversableOnce[Double]) : Unit =
	for ( value <- values )
	  appendDouble(attr, value)
  
}